import React, { useRef } from 'react';
import store from '../store'
import * as types from '../store/actionTypes'
export default () => {
  const inputRef = useRef()
  const addNewActivity = () => {
    store.dispatch({
      type: types.ADDACTIVITY,
      text: inputRef.current.value
    })
  }
  return (
    <>
      <input ref={inputRef} />
      <button onClick={addNewActivity}>添加</button>
    </>
  )
}